/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Controler;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
/**
 *
 * @author Maria
 */
public class ConexDB {
    private Connection connection = null;
    private Connection con;

    public Connection getCon() {
        return con;
    }
    
    
 public void connection(){
     try {
 
			Class.forName("oracle.jdbc.driver.OracleDriver");
                        
 
		} catch (ClassNotFoundException e) {
 
			System.out.println("JDBC Driver not found");
			e.printStackTrace();
			return;
 
		}
     //Connection connection = null;
     
   
     
     String URL = "jdbc:oracle:thin:@localhost:1521:xe";
     String  user =  "SYSTEM";
     String psw = "sysadm";
    try
    {
        Statement stmt = null;
        System.out.println("entra a conexion");
       
        con = DriverManager.getConnection(
                         URL,
                        user,
                        psw );
       // System.out.println("q");
        
       stmt = con.createStatement();
       // ResultSet rs = stmt.executeQuery(query);
        
       

        
       } catch (SQLException e) {
 
			System.out.println("Connection Failed! ");
			e.printStackTrace();
			return;
 
		}
      /* String query = "select user_id " +
                   "from " +  "ex_user";
       stmt = con.createStatement();
        ResultSet rs = stmt.executeQuery(query);
        
        System.out.println(query);
        while (rs.next()) {
            String var = rs.getString("user_id");
            System.out.println(var);
            
        }

    }catch (SQLException se) 
    {
        
    }*/
 }
 public void addCountry (String nameCountry, String export, String importVal )
 {
     
         String query, table, from, where, value ;
         table = "";
         value = nameCountry + ", "+export+ ", "+importVal;
         query= "Insert into "+table+ " values ("+ value+")";
         
     }
 
 
 
 
}
